<template>

    <view class="w-full h-[150rpx] flex-col-center gap-2">
        <image class="w-[180rpx] h-[80rpx]" mode="aspectFit" :src="src" />
        <view class="text-30rpx font-bold">{{ name }}</view>
    </view>
</template>

<script setup lang="ts">
import { onMounted, ref } from 'vue';
import { PlatformUtils } from '@/utils/channel';
import { useCustomHospitalEvent } from '@/composables/useHospitalEvent';

const src = ref('')
const name = ref('')


onMounted(() => {
    updateLogo()
})

function updateLogo() {
    const isAnHao = PlatformUtils.isAnHao()
    const defaultHospital = PlatformUtils.getDefaultHospital();
    name.value = defaultHospital.name
    if (isAnHao) {
        src.value = 'https://anfine.huasun-healthcare.com/kefu/anhao-logo.png'
    }
    else {
        src.value = 'https://anfine.huasun-healthcare.com/kefu/huasheng-logo.png'
    }
}

// 医院数据变化处理函数
function handleHospitalChange(hospital: any) {
    updateLogo();
}

// 使用自定义医院事件监听
useCustomHospitalEvent(handleHospitalChange);

</script>